package org.example.journal_items.common;

import lombok.Getter;

@Getter
public enum ResultCode {
  SUCCESS(200, "操作成功"),
  FAILED(500, "操作失败"),
  VALIDATE_FAILED(400, "参数检验失败"),
  UNAUTHORIZED(401, "暂未登录或token已经过期"),
  FORBIDDEN(403, "没有相关权限"),
  NOT_FOUND(404, "资源不存在"),
  METHOD_NOT_ALLOWED(405, "请求方法不允许"),
  CONFLICT(409, "资源冲突"),
  TOO_MANY_REQUESTS(429, "请求过于频繁"),
  INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
  SERVICE_UNAVAILABLE(503, "服务不可用"),

  // 自定义错误码
  USERNAME_NOT_EXIST(1001, "用户名不存在"),
  WRONG_PASSWORD(1002, "密码错误"),
  USERNAME_ALREADY_EXISTS(1003, "用户名已存在");

  private final int code;
  private final String message;

  ResultCode(int code, String message) {
    this.code = code;
    this.message = message;
  }
}